package com.video.chat.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.video.chat.domain.entity.MessageEntity;
import com.video.chat.mapper.ChatMessageMapper;
import com.video.chat.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MessageServiceImpl extends ServiceImpl<ChatMessageMapper,MessageEntity> implements MessageService {

    @Autowired
    private ChatMessageMapper chatMessageMapper;
    @Override
    public List<MessageEntity> getChatHistory(Long userId, Long friendId) {
       return chatMessageMapper.getChatHistory(userId, friendId);
    }

    @Override
    public void saveMessage(MessageEntity messageEntity) {
        chatMessageMapper.insert(messageEntity);
    }


}
